{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "dummy = \"\"\"r,g,b,c,m,y,k,RGB Hexadecimal,reanalysis\n",
    "    226, 31, 38,  0,86.28,83.19,11.37,  E21F26,  MERRA2\n",
    "    246, 153, 153,  0,37.8,37.8,3.53,  F69999,  MERRA\n",
    "    41, 95, 138,  70.29,31.16,0,45.88,  295F8A,  ERAI\n",
    "    95, 152, 198,  52.02,23.23,0,22.35,  5F98C6,  ERA5\n",
    "    175, 203, 227,  22.91,10.57,0,10.98,  AFCBE3,  ERA40\n",
    "    114, 59, 122,  6.56,51.64,0,52.16,  723B7A,  JRA55\n",
    "    173, 113, 181,  4.42,37.57,0,29.02,  AD71B5,  JRA-55C or JRA-55 AMIP\n",
    "    214, 184, 218,  1.83,15.6,0,14.51,  D6B8DA,  JRA-25\n",
    "    245, 126, 32,  0,48.57,86.94,3.92,  F57E20,  NCEP-R1\n",
    "    253, 191, 110,  0,24.51,56.52,0.78,  FDBF6E,  NCEP-R2\n",
    "    236, 0, 140,  0,100,40.68,7.45,  EC008C,  20CRv2c\n",
    "    247, 153, 209,  0,38.06,15.38,3.14,  F799D1,  20CRv2\n",
    "    0, 174, 239,  100,27.2,0,6.27,  00AEEF,  CERA-20C\n",
    "    96, 200, 232,  58.62,13.79,0,9.02,  60C8E8,  ERA-20C\n",
    "    52, 160, 72,  67.5,0,55,37.25,  34A048,  CFSR\n",
    "    179, 91, 40,  0,49.16,77.65,29.8,  B35B28,  REM\n",
    "    255,215,0,  0,15.69,100,0,  FFD700,  Other\n",
    "    0, 0, 0,  0,0,0,100,  000000,  Obs\n",
    "    119, 119, 119,  0,0,0,53.33,  777777,  Other Obs\"\"\"\n",
    "\n",
    "reanalysis_color = {}\n",
    "for line in dummy.split('\\n')[1:]:\n",
    "    v, k = line.split(',')[-2:]\n",
    "    reanalysis_color[k.strip()] = '#'+v.strip()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "= {\n",
      "    'MERRA2': '#E21F26',\n",
      "    'MERRA': '#F69999',\n",
      "    'ERAI': '#295F8A',\n",
      "    'ERA5': '#5F98C6',\n",
      "    'ERA40': '#AFCBE3',\n",
      "    'JRA55': '#723B7A',\n",
      "    'JRA-55C or JRA-55 AMIP': '#AD71B5',\n",
      "    'JRA-25': '#D6B8DA',\n",
      "    'NCEP-R1': '#F57E20',\n",
      "    'NCEP-R2': '#FDBF6E',\n",
      "    '20CRv2c': '#EC008C',\n",
      "    '20CRv2': '#F799D1',\n",
      "    'CERA-20C': '#00AEEF',\n",
      "    'ERA-20C': '#60C8E8',\n",
      "    'CFSR': '#34A048',\n",
      "    'REM': '#B35B28',\n",
      "    'Other': '#FFD700',\n",
      "    'Obs': '#000000',\n",
      "    'Other Obs': '#777777',\n",
      "  }\n"
     ]
    }
   ],
   "source": [
    "print ('= {')\n",
    "for key, value in reanalysis_color.items():\n",
    "    print (\"    '{:s}': '{:s}',\".format(key, value))\n",
    "print ('  }')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
